var deviceone = require("deviceone");
var httpUtil = require("helper/httpSilence");
var userUrl = require("url/user");
function home(){
	var device = deviceone.sm("do_Device");
	return device.home();
}
module.exports.home = home;
/** 同步方法 **/
function getInfo(){
	var device = deviceone.sm("do_Device");
	return device.getInfo();
}
/**
 *(同步方法)获取系统类型:1-android;2-ios;3-window 
 **/
function getOsType(){
	var rt = "1";
	var name = getInfo().OS;
	if(name && name!=="undefined"){
		name = name.toLowerCase();
	}
	if(name.indexOf("iphone")>=0||name.indexOf("ios")>=0){
		rt = "2";
	}else if(name.indexOf("window")>=0){
		rt = "3";
	}
	return rt;
}
module.exports.getOsType = getOsType;
module.exports.initDevice = function(){
	var info = getInfo();
	if(!info||info==null||info==="undefined"){
		return;
	}
	httpUtil.post(userUrl.url.deviceinfo.add,info,function(data){
	});
};
module.exports.getInfo = getInfo;